home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / asmlib35.zip / INPUT.DOC < prev    next >
Text File  |  1993-01-20  |  27KB  |  735 lines

  1.  
  2. ********************************  INPUT  ************************************
  3.  
  4. ASMLIB Input subroutines Copyright (C) 1991 - 1993 Douglas Herr
  5. all rights reserved
  6.  
  7. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  8.  
  9. A$EDIT:      editor module used by TEdit and GEdit.
  10.              Must be called by GEdit or TEdit
  11. Source:      a$edit.asm (getkey.asm, isdigit.asm, toupper.asm, tolower.asm)
  12.  
  13.              TEdit and GEdit edit a string on a single row of the screen
  14.              (without word wrap).  Strings longer than the column width of
  15.              the screen are scrolled left or right as required.  A public
  16.              byte in A$EDIT's data area, EWIDTH, establishes the effective
  17.              screen width limit.  EWIDTH is a not-to-exceed limit; if the
  18.              actual screen width is less than EWIDTH, EWIDTH is ignored
  19.              and the actual screen width is used instead.  ASMLIB's default
  20.              EWIDTH is 132.
  21.  
  22.              A$EDIT commands for both TEdit and GEdit are:
  23.  
  24.              Ctrl+left arrow = word left
  25.              Ctrl+right arrow = word right
  26.              Ctrl+end = clear to end of string
  27.              Home = go to start of string
  28.              End = go to end of string
  29.  
  30.  
  31.              Option bits, passed to GEdit or TEdit in register AL, are:
  32.  
  33.              Option 1 = upper case input
  34.              Option 2 = lower case input
  35.              Option 1 OR 2 = digits only input
  36.  
  37. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  38.  
  39. CLEARKEY:    clears the keyboard's 'type-ahead' buffer
  40.              Uses BIOS functions to remove all keys in the buffer.
  41. Source:      clearkey.asm
  42.  
  43. Call with:   no parameters
  44. Returns:     nothing
  45. Uses:        nothing
  46. Supports:    standard and enhanced keyboards
  47. Example:     call   clearkey
  48.  
  49.  
  50.  
  51. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  52.  
  53. GEDIT:       string editor for graphics modes
  54.              See also TEdit for text modes, A$EDIT for general information
  55. Source:      gedit.asm (a$edit.asm, gprint.asm, a$graph.asm, gcursor.asm,
  56.                         strspace.asm, heap.asm)
  57.  
  58. Call with:   DS:[SI] pointing to string buffer; may include a default string
  59.              DS:[DX] pointing to x- & y-coordinates
  60.              assumes DS:@data
  61.              CX = byte size of buffer
  62.              AL = option bits (see A$EDIT)
  63.              You must initialize the near heap before calling GEdit.
  64.              GEdit only works with DrawMode 1 or -1 (see DrawMode in
  65.              GRAPHICS.DOC).  GEdit forces drawmode to 1 or -1 and restores
  66.              the previous drawmode on exit.
  67. Returns:     AX = last key pressed (see getkey for key codes)
  68.              CX = new string length
  69. Uses:        AX, CX, flags
  70. Supports:    all ASMLIB graphics modes
  71. Example:
  72.  
  73. .data
  74. x       dw 8                      ; x-coordinate (pixels from left edge)
  75. y       dw 100                    ; y-coordinate (pixels from top of screen)
  76. extrn   ewidth:byte               ; byte in A$EDIT used to limit columns
  77.                                   ; displayed
  78. .code
  79. ; program fragment assumes DS:@data
  80.         .
  81.         .
  82.         .
  83.         mov   ewidth,40           ; there's stuff on the right side of
  84.                                   ; the screen that should be left alone
  85.  
  86.         lea   si,string_buffer    ; near address of string buffer
  87.         mov   cx,len_buffer       ; byte length of buffer for the string
  88.         mov   al,0                ; nothing tricky
  89.         lea   dx,x                ; point to x & y coordinates
  90.                                   ; see GPrint for explanation of x and y
  91.         call  gedit
  92.  
  93.  
  94.  
  95. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  96.  
  97. GETKEY:      returns next key pressed
  98. Source:      getkey.asm
  99.  
  100. Call with:   no parameters
  101. Returns:     AL = ASCII key code
  102.              AH = 0 if normal key
  103.              AH = 1 if extended key code (such as function keys)
  104. Uses:        AX
  105.              Uses BIOS functions; supports enhanced keyboard if present
  106. Supports:    standard and enhanced keyboards
  107. Example:     call  getkey
  108.              shr   ah,1            ; a function key?
  109.              jc    function_key    ; jump if so
  110.  
  111.  
  112.  
  113. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  114.  
  115. GPICKF:      pick a file from a list of filenames
  116.              GPickF pops a window on the screen and displays filenames
  117.              matching an input filespec mask.  One filename may be selected
  118.              with cursor keys or with hotkeys.  When Esc, Enter or ^C is
  119.              pressed, GPickF restores the screen and returns the selected
  120.              filename to the calling program.
  121.              Unused memory must be released by STARTUP (see STARTUP.ASM or
  122.              TINY.ASM).  Also requires near heap (see HINIT).
  123.              See also MenuOption.
  124. Source:      gpickf.asm (filelist.asm, $gpick.asm, a$menu.asm, $graph.asm)
  125.  
  126. Call with:   DS:[SI] pointing to filespec mask
  127.              BX = initial selection (0 = first filename)
  128.              CX = file attribute mask
  129.              DS:[DX] pointing to upper left corner of menu box
  130.              assumes DS:DGROUP
  131. Returns:     AX = last key pressed
  132.              ES:[BX] points to filename selected
  133.              CX = maximum length of filename
  134. Uses:        AX, BX, CX, ES
  135. Supports:    all ASMLIB graphics modes
  136. Example:     see PICKF
  137.  
  138. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  139.  
  140. GPICKSTR:    pick a string from a list of ASCIIZ strings
  141. Source:      gpickstr.asm ($gpick.asm, $strlist.asm, a$menu.asm, $graph.asm)
  142.  
  143. Call with:   DS:[SI] pointing to list of ASCIIZ strings
  144.              BX = initial cursor position
  145.              DS:[DX] pointing to (x,y) coordinates of upper left corner
  146.                of selection box
  147.  
  148.              GPickStr pops a window on the screen and displays the list
  149.              of strings.  One string may be selected with cursor keys
  150.              or with hotkeys.  When Esc, Enter or ^C is pressed, GPickStr
  151.              restores the screen and returns a string index number.
  152.              Unused memory must be released by STARTUP (see STARTUP.ASM and
  153.              TINY.ASM), and the near heap must be initialized (see HINIT).
  154.              See also MenuOption.  Maximum number of choices: 255
  155.  
  156. Returns:     AX = last key pressed
  157.              BX = string number selected (first string = 0)
  158. Uses:        AX, BX
  159. Supports:    all ASMLIB graphics modes
  160. Example:     see PICKSTR
  161.  
  162.  
  163. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  164.  
  165. ISALPHA:     determines if a keycode returned by GetKey is a letter from
  166.              A-Z or a-z.
  167. Source:      isalpha.asm
  168.  
  169. Call with:   AX = keycode returned by GetKey.
  170. Returns:     if CF = 0, keycode is a character from A-Z or a-z
  171.              if CF = 1, keycode is not a character from A-Z or a-z
  172.              AX is not changed
  173. Uses:        CF
  174. Example:     call   getkey       ; get next keystroke
  175.              call   isalpha
  176.              jc     not_alpha
  177.  
  178.  
  179.  
  180. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  181.  
  182. ISDIGIT:     determines if a keycode returned by GetKey is the ASCII code
  183.              for the numeric characters 0-9
  184. Source:      isdigit.asm
  185.  
  186. Call with:   AX = keycode returned by GetKey.
  187. Returns:     if CF = 0, keycode is a character from 0-9
  188.              if CF = 1, keycode is not a character from 0-9
  189.              AX is not changed
  190. Uses:        CF
  191. Example:     call   getkey       ; get next keystroke
  192.              call   isdigit      ; I want numbers only
  193.              jc     not_a_number
  194.  
  195.  
  196.  
  197. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  198.  
  199. ISLOWER:     determine if a keycode returned by GetKey is lower case
  200. Source:      islower.asm
  201.  
  202. ISUPPER:     determine if a keycode returned by GetKey is upper case
  203. Source:      isupper.asm
  204.  
  205. Call with:   AX = keycode returned by GetKey.
  206. Returns:     if CF = 0, keycode is a character from A-Z or a-z
  207.              if CF = 1, keycode is not a character from A-Z or a-z
  208.              AX is not changed
  209. Uses:        CF
  210. Example:     call   getkey       ; get next keystroke
  211.              call   isupper      ; is it upper case?
  212.              jc     not_upper    ; no; could be lower case
  213.  
  214.  
  215. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  216.  
  217. JANEIN:      German language version of YesNo
  218.              waits for 'J' or 'N' key to be pressed
  219. Source:      janein.asm
  220.  
  221. Call with:   no parameters
  222.              Key pressed may be upper or lower case.  Upper case is
  223.              returned.  Uses BIOS functions
  224. Returns:     AX = 'J' or AX = 'N'
  225.              future versions will also return ^C
  226. Uses:        AX
  227. Example:     call  JaNein
  228.  
  229.  
  230.  
  231. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  232.              
  233. KEYIFWAITING:Returns first key if one is waiting in the keyboard buffer,
  234.              or returns with no keycode if no keypress is waiting.
  235. Source:      kifwait.asm (getkey.asm)
  236.  
  237. Call with:   no parameters
  238. Returns:     AX = 0 if no key waiting
  239.              AX = keycode if one is waiting in the buffer.  Uses BIOS.
  240. Uses:        AX
  241. Example:     call  keyifwaiting
  242.  
  243.  
  244.  
  245. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  246.  
  247. KEYORBUTTON: waits for first keypress or mouse button click
  248. Source:      mouse.asm (getkey.asm)
  249.  
  250. Call with:   no parameters
  251.              If a keypress is waiting in the keyboard buffer before
  252.              this subroutine is called, the keycode is returned to
  253.              the calling program without checking mouse button status.
  254. Returns:     AX = keycode, BX = mouse button code (see MouseStatus)
  255. Uses:        AX, BX
  256. Supports:    2- or 3-button mouse, standard or enhanced keyboard
  257. Example:     call   keyorbutton
  258.  
  259.  
  260. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  261.  
  262. KEYWAITING:  Determines if a key is waiting in the keyboard buffer.
  263.              Does not remove the key code from the buffer.  Uses BIOS.
  264. Source:      getkey.asm
  265.  
  266. Call with:   no parameters
  267. Returns:     AX = 0 if no key waiting
  268.              AX = 1 if key waiting
  269. Uses:        AX
  270. Supports:    standard or enhanced keyboard
  271. Example:     call   keywaiting
  272.              or     ax,ax        ; has a key been pressed?
  273.              jz     no_key       ; nope, not yet
  274.  
  275.  
  276. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  277.  
  278. MENUOPTION:  options for PULLDOWN, PICKF, GPICKF, PICKSTR and GPICKSTR
  279. Source:      a$menu.asm
  280.  
  281. Call with:   AX = option value
  282.              BX = option number
  283.  
  284.              If you do not specify any options or if you call MenuOption
  285.              with AX = 0, default values are assumed.
  286.  
  287.              options available are:           defaults:
  288.                0 = normal text color            07h
  289.                1 = current selection color      70h
  290.                2 = list box color               0Fh
  291.                3 = hotkey color                 0Fh         (1)
  292.                4 = optional quitkey             no quitkey  (2)
  293.                5 = exit when hotkey pressed     00h         (3)
  294.                6 = box frame type (see WFRAME)  -1          (4)
  295.  
  296. NOTE: DEFAULT COLORS MAY NOT BE SUITABLE FOR SOME GRAPHICS MODES
  297.  
  298. (1) the first upper-case letter in each string is that string's hotkey
  299.     no upper-case character = no hotkey
  300. (2) the quitkey value is a keycode returned by GetKey
  301. (3) use AX = -1 for exit when hotkey pressed, AX = 0 to disable
  302. (4) text modes only
  303.  
  304. Returns:     nothing
  305. Uses:        nothing
  306. Supports:    GPickF, GPickStr, PullDown, PickF, PickStr menu systems
  307. Example:
  308.  
  309. include   asm.inc
  310. extrn     menuoption:proc, pulldown:proc
  311.  
  312. .code
  313.           .
  314.           .
  315.           .
  316.           mov   bx,0         ; text color
  317.           mov   ax,23        ; white w/ blue background
  318.                              ; in graph modes, this would be
  319.                              ; MOV  AX,0107h  (see GCOLOR in GRAPHICS.DOC)
  320.           call  menuoption
  321.  
  322.  
  323.  
  324.  
  325. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  326.  
  327. MOUSELIMIT:  limits mouse's range of motion
  328. Source:      mouse.asm
  329.  
  330. Call with:   DS:[BX] pointing to pixel coordinates of minimum and maximum
  331.              x and y limits.  X-limits are the horizontal dimension and
  332.              y-limits are the vertical dimension.
  333. Returns:     nothing
  334. Uses:        nothing
  335. Example:
  336.  
  337. .data
  338.  
  339. x0    dw 30
  340. y0    dw 15
  341. x1    dw 620
  342. y1    dw 250
  343.  
  344. .code
  345. ; program gragment assumes DS:@data
  346.        .
  347.        .
  348.        .
  349.       lea    bx,x          ; DS:[BX] points to limits
  350.       call   mouselimit
  351.  
  352.  
  353. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  354.  
  355. MOUSEPOS:    sets the mouse's position
  356. Source:      mouse.asm
  357.  
  358. Call with:   DS:[DX] pointing to desired x- and y-coordinates
  359.              Note that mouse coordinates are expressed as a pixel location
  360.              as with graphics mode, even if the system is in text mode
  361. Returns:     nothing
  362. Uses:        nothing
  363. Example:
  364.  
  365. .data
  366.  
  367. x     dw 100
  368. y     dw 25
  369.  
  370. .code
  371. ; program gragment assumes DS:@data
  372.       .
  373.       .
  374.       .
  375.       lea    dx,x          ; DS:[DX] points to desired position
  376.       call   mousepos
  377.  
  378. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  379.  
  380. MOUSESTATUS: determine mouse position & buttons pressed
  381. Source:      mouse.asm
  382.  
  383. Call with:   no parameters
  384. Returns:     if ZF = 1, no buttons are pressed
  385.              if ZF = 0, BX = button code
  386.               BX bit 0 if set = left button is down
  387.               BX bit 1 if set = right button is down
  388.               BX bit 2 if set = center button is down
  389.              CX = horizontal (x) coordinate
  390.              DX = vertical (y) coordinate
  391.              Note that mouse positions are expressed as a pixel location
  392.              as with graphics mode, even if the system is in text mode
  393. Uses:        BX, CX, DX, flags
  394. Example:     call  mousestatus
  395.              jz    no_buttons     ; no buttons pressed if ZF = 1
  396.  
  397.  
  398. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  399.  
  400. OUINON:      French language version of YesNo
  401.              waits for 'O' or 'N' key to be pressed
  402. Source:      ouinon.asm
  403.  
  404. Call with:   no parameters
  405.              Key pressed may be upper or lower case.  Upper case is
  406.              returned.  Uses BIOS functions
  407. Returns:     AX = 'O' or AX = 'N'
  408.              future versions will also return ^C
  409. Uses:        AX
  410. Example:     call  OuiNon
  411.  
  412.  
  413.  
  414. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  415.  
  416. PICKF:       pick a file from a list of filenames
  417.              PickF pops a window on the screen and displays filenames
  418.              matching an input filespec mask.  One filename may be selected
  419.              with cursor keys or with hotkeys.  When Esc, Enter or ^C is
  420.              pressed, PickF restores the screen and returns the selected
  421.              filename to the calling program.
  422.              Unused memory must be released by STARTUP (see STARTUP.ASM).
  423.              See also MenuOption.
  424. Source:      pickf.asm ($pick.asm, $listw.asm, m$putw.asm, filelist.asm,
  425.                           dosalloc.asm, wsave.asm, a$menu.asm)
  426.  
  427. Call with:   DS:[SI] pointing to filespec mask
  428.              BX = initial cursor position
  429.              CX = file attribute mask
  430.              DH = top screen row for list
  431.              DL = left screen column for list
  432. Returns:     AX = last key pressed
  433.              ES:[BX] points to filename selected
  434.              CX = maximum length of filename
  435. Uses:        AX, BX, CX, ES
  436. Supports:    text mode
  437. Example:
  438.  
  439. include   asm.inc
  440.  
  441. public    myproc
  442. extrn     pickf:proc
  443.  
  444. .data
  445. filespec db '*.asm',0            ; search for ASM source code
  446.  
  447. .code
  448. ; program fragment assumes DS:@data
  449.         .
  450.         .
  451.         .
  452.         lea     si,filespec
  453.         mov     bx,0             ; start at top of list
  454.         xor     dx,dx            ; upper left corner of screen
  455.         mov     cx,0             ; normal files only
  456.         call    pickf
  457.         cmp     ax,0Dh           ; was Enter the last key pressed?
  458.         jne     abort            ;  nope - someone wants out
  459.         call    strndup          ;  yup - copy filename to near heap
  460.         mov     ah,49h
  461.         int     21h              ; release the filename buffer
  462.  
  463.  
  464. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  465.  
  466. PICKSTR:     pick a string from a list of ASCIIZ strings
  467. Source:      pickstr.asm ($pick.asm, m$putw.asm, $strlist.asm,
  468.                           dosalloc.asm, wsave.asm, a$menu.asm)
  469.  
  470. Call with:   DS:[SI] pointing to list of ASCIIZ strings
  471.              BX = initial cursor position
  472.              DH = top screen row for list
  473.              DL = left screen column for list
  474.  
  475.              PickStr pops a window on the screen and displays the list
  476.              of strings.  One string may be selected with cursor keys
  477.              or with hotkeys.  When Esc, Enter or ^C is pressed, PickStr
  478.              restores the screen and returns a string index number.
  479.              Unused memory must be released by STARTUP (see STARTUP.ASM).
  480.              See also MenuOption.  Maximum number of choices: 255
  481.  
  482. Returns:     AX = last key pressed
  483.              BX = string number selected (first string = 0)
  484. Uses:        AX, BX
  485. Supports:    text mode
  486. Example:
  487.  
  488. include   asm.inc
  489.  
  490. public    myproc
  491. extrn     pickstr:proc
  492.  
  493. .data
  494. string1   db 'January',0
  495.           db 'February',0
  496.           db 'March',0
  497.           db 'April',0
  498.           db 'May',0
  499.           db 'June',0
  500.           db 'July',0
  501.           db 'August',0
  502.           db 'September',0
  503.           db 'October',0
  504.           db 'November',0
  505.           db 'December',0
  506.           db 0              ; mark end of menu strings
  507.  
  508. .code
  509. ; program fragment assumes DS:@data
  510.         .
  511.         .
  512.      lea  si,string1
  513.      mov  bx,1
  514.      xor  dx,dx
  515.      call pickstr
  516.  
  517. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  518.  
  519. PULLDOWN:    pull-down menu system
  520. Source:      pulldown.asm (a$menu.asm, tprint.asm, tprintce.asm, tputchr.asm
  521.                            strlen.asm, wclear.asm, wframe.asm, wsize.asm
  522.                            wsave.asm, getkey.asm, pickstr.asm and others)
  523.  
  524. Call with:   DS:[SI] pointing to menu labels
  525.              BH = initial main menu choice, BL = initial submenu choice
  526.              assumes DS:@data
  527.              Unused memory must be released (see STARTUP.ASM and ENDPROG)
  528.  
  529.              If PullDown is called with BL < 0, only the main headings are
  530.              printed initally; the submenus are printed when ENTER is
  531.              pressed, a mouse button is pressed, or when either the down
  532.              arrow key is pressed or a "down" mouse movement is detected.
  533.  
  534.              If PullDown is called with BL >= 0, it starts in the full main
  535.              headings plus submenus mode.  In this mode, a mouse button
  536.              click or the ENTER key will exit PullDown.  In either mode,
  537.              ESC, ^C or the user-defined quitkey (see MenuOption) causes
  538.              PullDown to return to the calling program.
  539.  
  540.              If there are too many main headings to fit across the top of the
  541.              screen, the headings are scrolled left or right as required to
  542.              show the selected heading.  Use Left, Right, Home and End keys
  543.              to change selected headings.  Maximum number of headings: 20
  544.  
  545.              If there are too many submenu choices under a heading to fit
  546.              on the screen, the selections are scrolled up or down as required
  547.              to show the selected item.  Use Up, Down, PgUp, PgDown keys
  548.              to change selection, or press highlighted letter of selection.
  549.              Maximum number of selections per heading: 255
  550.  
  551. Returns:     BH = main menu choice, BL = submenu choice
  552.              if CF = 1, ^C or Ctrl-Break was pressed
  553.              if CF = 0
  554.                  AX = 13 if ENTER was pressed
  555.                  AX = user-defined quitkey if pressed (see MenuOption)
  556.                  AX = 0 if insufficient DOS memory is available
  557.                  AX = 27 if ESC was pressed
  558.                  AH = 1-7, AL = 0 if mouse button pressed
  559. Uses:        AX, BX
  560. Supports:    text mode; all row/column configurations supported by ASMLIB
  561.              Text subroutines
  562. Example:
  563.  
  564. see next page
  565.  
  566. ;    this sample menu has 4 main menu headings:
  567. ;                          Critters, Things, Food, Trees
  568. ;    submenu choices for each main heading follow each main heading
  569. ;    Note that each string is terminated with NUL, and that there's an
  570. ;    extra NUL between the end of the submenu choices and the next main
  571. ;    heading.
  572. ;    The entire set of menu choices is terminated with 2 NUL bytes
  573. ;
  574. ;    PULLDOWN will return to the calling program when either ESCAPE or
  575. ;    ENTER is pressed (AX = ASCII code of key pressed).  PULLDOWN returns
  576. ;    AX = 0 if insufficient memory is available to save the underlying
  577. ;    screen, or AX = 3 if breaktrap was enabled and Ctrl+Break was pressed.
  578. ;
  579. ;    On return, BH = the main heading and BL = the submenu choice in effect
  580. ;    when the key was pressed.  The first main heading is number 0, and
  581. ;    the first submenu choice for each main heading is also number 0.
  582.  
  583. include asm.inc
  584.  
  585. extrn     pulldown:proc
  586.  
  587. .stack
  588.  
  589. .data
  590. menu    db 'Critters',0
  591.         db 'Goats',0,'Chickens',0,'Turkeys',0,'Cows',0,'Snow dogs',0
  592.  
  593.         db 0                   ; separate Things from Critters
  594.         db 'Things',0
  595.         db 'Computers',0,'Tractors',0,'CPU chips',0,'Barbie dolls',0
  596.  
  597.         db 0                   ; separate Food from Things
  598.         db 'Food',0
  599.         db 'Hot dogs',0,'Wheat germ',0,'Lasagne',0,'Cheerios',0
  600.         db 'Potatoes',0,'chocolate chip cooKies',0
  601.  
  602.         db 0                   ; separate Trees from Food
  603.         db 'Trees',0
  604.         db 'giant Sequoia',0,'black Spruce',0,'Willow',0,'live Oak',0
  605.         db 'Acacia',0,'digger Pine',0
  606.  
  607.         db 2 dup(0)            ; end of menu choices
  608.  
  609. .code
  610. ; program fragment assumes DS:@data
  611.         .
  612.         .
  613.         .
  614.         lea   si,menu          ; point to menu labels
  615.         xor   bx,bx            ; initial selection is "goats"
  616.         call  pulldown
  617.  
  618.  
  619. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  620.  
  621. SINO:        Spanish language version of YesNo
  622.              waits for 'S' or 'N' key to be pressed
  623. Source:      sino.asm
  624.  
  625. Call with:   no parameters
  626.              Key pressed may be upper or lower case.  Upper case is
  627.              returned.  Uses BIOS functions
  628. Returns:     AX = 'S' or AX = 'N'
  629.              future version will also return ^C
  630. Uses:        AX
  631. Example:     call  sino
  632.  
  633.  
  634. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  635.  
  636. TEDIT:       ASCIIZ string editor for text modes
  637.              See also GEdit for graphics modes, A$EDIT for general information.
  638.              TEdit turns the cursor off (with CursorOFF) on exit.
  639. Source:      tedit.asm (a$edit.asm, cursor.asm, a$clrw.asm, str2vbuf.asm,
  640.                         crtinfo.asm)
  641.  
  642. Call with:   DS:[SI] pointing to string buffer; may include a default string
  643.              assumes DS:@data
  644.              CX = byte size of buffer (excluding terminating NUL)
  645.              AH = color attribute
  646.              AL = option bits (see A$EDIT)
  647.              DH = row (offset from top of screen)
  648.              DL = column (offset from left edge of screen)
  649.  
  650. Returns:     AX = last key pressed (see GetKey for key codes)
  651.              CX = new string length
  652. Uses:        AX, CX, flags
  653. Supports:    text modes; all row/column configurations
  654. Example:     lea   si,string_buffer    ; near address of string buffer
  655.              mov   cx,len_buffer       ; byte length of buffer for the string
  656.              mov   dh,row
  657.              mov   dl,column
  658.              mov   ah,attr             ; color attribute
  659.              mov   al,2                ; force lower case
  660.              call  tedit
  661.  
  662.  
  663.  
  664. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  665.  
  666. TMOUSELIMIT: limits mouse's range of motion on text mode screen
  667. Source:      tmlimit.asm
  668.  
  669. Call with:   DS:[BX] pointing to character coordinates of minimum and maximum
  670.              rows and columns.  Columns are the horizontal dimension and
  671.              rows are the vertical dimension.
  672. Returns:     nothing
  673. Uses:        nothing
  674. Example:
  675.  
  676. .data
  677.  
  678. x0    dw 3          ; first row
  679. y0    dw 1          ; first column
  680. x1    dw 20         ; last row
  681. y1    dw 50         ; last column
  682.  
  683. .code
  684. ; program fragment assumes DS:@DATA
  685.        .
  686.        .
  687.        .
  688.       lea    bx,x          ; DS:[BX] points to limits
  689.       call   tmouselimit
  690.  
  691.  
  692.  
  693. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  694.  
  695. TOLOWER:     converts keycode returned by getkey to lower case
  696. Source:      tolower.asm
  697.  
  698. Call with:   AX = keycode
  699. Returns:     AX = lower case keycode
  700.              ToLower leaves the keycode alone if the keycode is not
  701.              upper case A-Z.
  702. Uses:        AX
  703. Example:     call   getkey
  704.              call   tolower
  705.  
  706.  
  707. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  708.  
  709. TOUPPER:     converts keycode returned by getkey to upper case
  710. Source:      toupper.asm
  711.  
  712. Call with:   AX = keycode
  713. Returns:     AX = upper case keycode
  714.              ToUpper leaves the keycode alone if the keycode is not
  715.              lower case a-z.
  716. Uses:        AX
  717. Example:     call   getkey
  718.              call   toupper
  719.  
  720.  
  721. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  722.  
  723. YESNO:       waits for 'Y' or 'N' key to be pressed
  724. Source:      yesno.asm
  725.  
  726. Call with:   no parameters
  727.              Key pressed may be upper or lower case.  Upper case is
  728.              returned.  Uses BIOS functions
  729. Returns:     AX = 'Y' or AX = 'N'
  730.              future version will also return ^C
  731. Uses:        AX
  732. Example:     call  yesno
  733.  
  734.  
  735.